function checkUserName() {
			var username = $("#username").val();
			if (username === null || $.trim(username).length === 0 ) {
				alert("username could not be null");
				$("#username").focus();
				return false ;
			} 
			return true ;
		}
		function checkPassword() {
			var password = $("#password").val();
			if (password === null || $.trim(password).length === 0 ) {
				alert("password could not be null");
				$("#password").focus();
				return false ;
			} 
			return true ;
		}
		function checkConfirm() {
			var confirm = $("#confirm").val();
			var password = $("#password").val();
			if (confirm === null || $.trim(confirm).length === 0 ) {
				alert("confirm could not be null");
				$("#confirm").focus();
				return false ;
			} else if ( confirm != password) {
				alert("the two password are not identical");
				$("#confirm").focus();
				return false ;
			}
			return true ;
		}
		function checkLastName() {
			var lastname = $("#lastname").val();
			if (lastname === null || $.trim(lastname).length === 0 ) {
				alert("lastname could not be null");
				$("#lastname").focus();
				return false ;
			} 
			return true ;
		}
		function checkFirstName() {
			var firstname = $("#firstname").val();
			if (firstname === null || $.trim(firstname).length === 0 ) {
				alert("firstname could not be null");
				$("#firstname").focus();
				return false ;
			} 
			return true ;
		}
		function checkBirthday() {
			var birthday = $("#birthday").val();
			if ( birthday != null && $.trim(birthday).length != 0 ) {
				var regx = /^\d{4}\-\d{2}\-\d{2}$/; 
				if (!regx.test(birthday)){
					alert("data format error!");
					$("#birthday").focus();
					return false;		
				}
				return true ;
			}
			alert("birthday not be null");
			$("#birthday").focus();
			return false;
		}
		function checkCellPhone() {
			var cellphone = $("#cellphone").val();
			if ( cellphone != null && $.trim(cellphone).length != 0 ) {	
				var regx = /^(\+\d{2,3}\-)?\d{11}$/;
				if (! regx.test(cellphone)) {
					alert("data format error!");
					$("#cellphone").focus();
					return false ;
				}
				return true ;
			}
			alert("cellphone not be null");
			$("#cellphone").focus();
			return false ;
		}
		function checkOfficePhone() {
			var officeTel = $("#officeTel").val();
			if ( officeTel != null && $.trim(officeTel).length != 0 ) {
			
				var regx = /^(\d{3,4}\-)?\d{7,8}$/;
				if ( ! regx.test(officeTel) ) {
					alert("data format error");
					$("#officeTel").focus();
					return false ;
				}
				return true ;
			}
			alert("office telphone not be null");
			$("#officeTel").focus();
			return false ;
		}
		
		function checkFamilyPhone() {
			var familyTel = $("#familyTel").val();
			if ( familyTel != null && $.trim(familyTel).length != 0 ) {
			
				var regx = /^(\d{3,4}\-)?\d{7,8}$/;
				if ( ! regx.test(familyTel) ) {
					alert("data format error");
					$("#familyTel").focus();
					return false ;
				}
				return true ;
			}
		}
		function checkHospitalPhone() {
			var hospitalTel = $("#hospitalTel").val();
			if ( hospitalTel != null && $.trim(hospitalTel).length != 0 ) {
			
				var regx = /^(\d{3,4}\-)?\d{7,8}$/;
				if ( ! regx.test(hospitalTel) ) {
					alert("data format error");
					$("#hospitalTel").focus();
					return false ;
				}
				return true ;
			}
		}
		function checkEmail() {
			var email = $("#email").val();
			if ( email != null && $.trim(email).length != 0 ) {
				var regx = /^\w{3,}@\w+(\.\w+)+$/;
				if ( ! regx.test(email) ) {
					alert("data format error");
					$("#email").focus();
					return false;
				}
				return true ; 
			}
			alert("email not be null");
			$("#email").focus();
			return false;
		}

	function checkFax() {
		var fax = $("#fax").val();
		if( fax != null && $.trim(fax).length != 0) {
			var regx = /^(\d{3,4}\-)?\d{7,8}$/;
			if (! regx.test(fax)){
				alert("data format error");	
				$("#fax").focus();
				return false;
			}
		}
		return true;	
	}
	function checkForm() {
		if (checkUserName() && checkConfirm() && checkFirstName() && checkLastName() && 
			checkBirthday() && checkCellPhone() && checkOfficePhone() &&  
			checkHospitalPhone() && checkEmail()) {
			return true;
		}
		return false;
	}